<template>
	<uni-indexed-list :options="list" :show-select="false" @click="bindClick" />
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				list: [
					{
					    "letter": "A",
					    "data": [
					        "阿翔",
					        "阿弥陀佛",
					        "阿里郎",
					        "安心",
							"安定"
					    ]
					}, {
					    "letter": "B",
					    "data": [
					        "baby",
					        "包青天",
					        "宝1",
					        "宝2",
					        "宝3"
					    ]
					}, {
					    "letter": "C",
					    "data": [
					        "测试1",
					        "测试2",
					        "测试3",
					        "测试4",
					        "测试5"
					    ]
					}
				],
				contacts:[
					{
						name:"测试1",
						phone:"13874997331"
					}
				]
			}
		},
		methods: {
			bindClick(e) {
				console.log('点击item，返回数据' + JSON.stringify(e))
				let user = this.contacts.filter(con => {
					return con.name == e.item.name;
				})
				this.$modal.confirm('确定拨打'+e.item.name+'的电话？').then(() => {
				  uni.makePhoneCall({
				  	phoneNumber:user[0].phone
				  })
				})
				
			}
		}
	}
</script>

<style>
	.uni-indexed-list__item-content:before{
		content:"";
		display: inline-block;
		margin-right: 5px;
		width: 10px;
		height: 10px;
		border-radius: 20px;
		background-color: #255CC3;
	}
</style>